Skip to content

Cleanup, Tests | MultipartIdentifier#3891

Merged
paulmedynski merged 21 commits intodotnet:mainfrom
edwardneal:cleanup/multipartidentifier
Mar 9, 2026
Merged

Cleanup, Tests | MultipartIdentifier#3891
paulmedynski merged 21 commits intodotnet:mainfrom
edwardneal:cleanup/multipartidentifier

Conversation

@edwardneal
Copy link
Contributor

Description

This work performs a small cleanup of the MultipartIdentifier type, and moves its test into the UnitTests project. That simplifies some of the tech debt identified in #3890, since we can use InternalsVisibleTo to access the type directly rather than manually include the source file.

This can be reviewed commit-by-commit - I don't expect any behavioural changes. There's existing test coverage, and this passes, but everything can be verified statically. These changes essentially remove parameters which are always constant, but which were passed as a result of the MultipartIdentifier type being originally used for providers other than SqlClient.

Issues

None, but dovetails with #3890 - @benrr101 for awareness.

Testing

Existing automatic tests cover this.

These were always passed with the same, constant, value.
This tested a case which would never occur.
Also remove now-unnecessary test case.
Also remove a now-unnecessary test case.
Remove unnecessary IsWhitespace method.
Replace always-true runtime checks against constant values with debug assertions.
This tested the exception thrown when limit is zero. This is always either 3 or 4.
…ional inclusion of MultipartIdentifier from FunctionalTests
@edwardneal edwardneal requested a review from a team as a code owner January 14, 2026 06:57
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Jan 14, 2026
@paulmedynski paulmedynski moved this from To triage to In review in SqlClient Board Jan 14, 2026
@paulmedynski paulmedynski added the Area\Tests Issues that are targeted to tests or test projects label Jan 14, 2026
@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another good move of some true unit tests, and valuable cleanup along the way. A few suggestions to improve the cleanup even more.

@github-project-automation github-project-automation bot moved this from In review to In progress in SqlClient Board Jan 14, 2026
Eliminates some ambiguity between "name" and "identifier", "identifier part" or "property name".
@edwardneal
Copy link
Contributor Author

Thanks @paulmedynski - I've just replied to the first round of review comments.

@github-actions
Copy link

This pull request has been marked as stale due to inactivity for more than 30 days.

If you would like to keep this pull request open, please provide an update or respond to any comments. Otherwise, it will be closed automatically in 7 days.

@github-actions github-actions bot added the Stale The Issue or PR has become stale and will be automatically closed shortly if no activity occurs. label Feb 14, 2026
@edwardneal
Copy link
Contributor Author

This PR is not stale.

@github-actions github-actions bot removed the Stale The Issue or PR has become stale and will be automatically closed shortly if no activity occurs. label Feb 15, 2026
@paulmedynski
Copy link
Contributor

@edwardneal Can you address the conflicts, and then I'll kick the pipelines and re-review.

@edwardneal
Copy link
Contributor Author

Thanks @paulmedynski - conflicts are merged.

@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Contributor

@paulmedynski paulmedynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvements, now looking for some wider unit test coverage

@paulmedynski paulmedynski self-assigned this Feb 18, 2026
@Wraith2
Copy link
Contributor

Wraith2 commented Feb 18, 2026

A few years ago I rewrote the multipart identifier class so that it no longer requires that it return string[] but can use a span or memory to contain the parse information and you can then extract the parts of the string that you want and write them to a stream or string as you need to. It looks like I never got around to PR'ing because there were more important things with higher impact in progress. Is there interest in a version which has lower possible allocations?

Replace various test cases with a Theory-based approach.
Widen code coverage, including cases for [], " and whitespace.
Prove both cases for throwOnEmptyMultiPartIdentifier.
@paulmedynski paulmedynski added this to the 7.0.0 milestone Mar 9, 2026
@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 98.73418% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 64.75%. Comparing base (0208d81) to head (1e28086).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
...lClient/src/Microsoft/Data/SqlClient/SqlCommand.cs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           main    #3891       +/-   ##
=========================================
+ Coverage      0   64.75%   +64.75%     
=========================================
  Files         0      282      +282     
  Lines         0    66045    +66045     
=========================================
+ Hits          0    42765    +42765     
- Misses        0    23280    +23280     
Flag Coverage Δ
PR-SqlClient-Project 64.75% <98.73%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmedynski
Copy link
Contributor

@Wraith2 - Yes, please open a PR with your changes!

@paulmedynski paulmedynski merged commit 326a242 into dotnet:main Mar 9, 2026
296 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in SqlClient Board Mar 9, 2026
@edwardneal edwardneal deleted the cleanup/multipartidentifier branch March 9, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Tests Issues that are targeted to tests or test projects

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants